﻿
@{
    ViewBag.Title = "EmployeePageList";
    Layout = "~/Views/Shared/_LayoutMain.cshtml";
}

@section css{
    <link href="~/Assets/css/lib/bootstrap-select.css" rel="stylesheet" />
    <style>
        .bg-light th {
            font-weight: bolder;
            text-align: center;
        }
    </style>
}
<header id="topbar">
    <div class="topbar-left">
        <ol class="breadcrumb">
            <li class="crumb-active">
                <a>体检记录管理</a>
            </li>
            <li class="crumb-trail">职业健康</li>
        </ol>
    </div>
</header>
<section id="content" class="animated fadeIn" ng-cloak ng-controller="OHSController" ng-init="SearchModel={};page='@(Request.QueryString["page"].IsEmpty() ? "1" : Request.QueryString["page"])';
     PageName='@Request.CurrentExecutionFilePath.Substring(Request.CurrentExecutionFilePath.LastIndexOf("/") + 1)';
     SearchModel={};
                 GetDepartmentList();
         GetResultTypeList();
         GetAllHarmList('search_Harm');
         GetCheckTypeList();
     GetCheckRecordPageList(SearchModel,page);">
    <div class="load" ng-show="DataLoading">
        <div class="loader">
            <svg version="1.1" id="loader-1" x="0px" y="0px" width="100px" height="100px" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve">
            <path fill="#000" d="M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z">
            <animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite" />
			</path>
		</svg>
            <div class="load-msg">正在加载</div>
        </div>
    </div>
    <form class="form-horizontal">
        <div class="panel">
            <div class="panel-heading">
                <span class="panel-title">
                    <span class="glyphicons glyphicons-filter"></span>搜索过滤
                </span>
            </div>
            <div class="panel-body fill">
                <div class="row">
                    <div class="form-group">
                        <label class="col-sm-1 control-label">姓名</label>
                        <div class="col-lg-1">
                            <input type="text" class="form-control" ng-model="SearchModel.EmployeeName" placeholder="姓名模糊查询" />
                        </div>

                        <label class="col-sm-1 control-label">工号</label>
                        <div class="col-lg-1">
                            <input type="text" class="form-control" ng-model="SearchModel.EmployeeNo" placeholder="工号模糊查询" />
                        </div>

                        <label class="col-sm-1 control-label">身份证号</label>
                        <div class="col-lg-2">
                            <input type="text" class="form-control" ng-model="SearchModel.IdCardNo" placeholder="身份证号模糊查询" />
                        </div>
                        <label class="col-sm-1 control-label">部门</label>
                        <div class="col-lg-2">
                            <select class="form-control" ng-model="SearchModel.DepartmentId" ng-change="GetCheckRecordPageList(SearchModel,1);">
                                <option value="">所有部门</option>
                                <option ng-repeat="x in DepartmentList" value="{{x.Id}}">{{x.DepartmentName}}</option>
                            </select>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="form-group">
                        <label class="col-sm-1 control-label">年份</label>
                        <div class="col-lg-1">
                            <select class="form-control" ng-model="SearchModel.Year" ng-change=" GetCheckRecordPageList(SearchModel,1);">
                                <option value="">所有年份</option>
                                <option value="2015">2015</option>
                                <option value="2016">2016</option>
                                <option value="2017">2017</option>
                                <option value="2018">2018</option>
                                <option value="2019">2019</option>
                                <option value="2020">2020</option>
                                <option value="2021">2021</option>
                                <option value="2022">2022</option>
                                <option value="2023">2023</option>
                                <option value="2024">2024</option>
                            </select>
                        </div>
                        <label class="col-sm-1 control-label">主检结论</label>
                        <div class="col-lg-1">
                            <select class="form-control" ng-model="SearchModel.ResultType" ng-change=" GetCheckRecordPageList(SearchModel,1);">
                                <option value="">全部结论</option>
                                <option value="{{x.Id}}" ng-repeat="x in ResultTypeList">{{x.ResultType}}</option>
                            </select>
                        </div>
                        <label class="col-sm-1 control-label">类型</label>
                        <div class="col-lg-2">
                            <select class="form-control" ng-model="SearchModel.CheckType" ng-change=" GetCheckRecordPageList(SearchModel,1);">
                                <option value="">全部类型</option>
                                <option value="{{x.Id}}" ng-repeat="x in CheckTypeList">{{x.CheckType}}</option>
                            </select>
                        </div>
                        <label class="col-lg-1 control-label">接害因素：</label>
                        <div class="col-lg-2">
                            <select id="search_Harm" class="selectpicker show-tick form-control" multiple data-live-search="true">
                            </select>
                        </div>
                        <div class="col-lg-1">
                            <button type="button" class="btn btn-primary" ng-click="GetCheckRecordPageList(SearchModel,1);">查询</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="panel panel-info">
            <div class="panel-heading">
                <span class="panel-title">
                    <span class="glyphicons glyphicons-list"></span>体检记录 总数：{{TotalCount}}
                </span>
                <div class="widget-menu pull-right mr10">
                    <div class="btn-group">
                        <a ng-if="@ViewBag.IsAdd==1" href="CheckRecordImport?page={{result.currentPage}}" class="btn btn-xs btn-primary  light ">
                            <i class="fa fa-plus"></i>导入数据
                        </a>
                    </div>
                </div>
            </div>
            <div class="panel-body">
                <table class="table table-bordered">
                    <thead>
                        <tr class="bg-light">
                            <th>序号</th>
                            <th>年份</th>
                            <th>工号</th>
                            <th>姓名</th>
                            <th>性别</th>
                            <th>身份证号</th>
                            <th>部门</th>
                            <th>体检日期</th>
                            <th>类型</th>
                            <th>工种</th>
                            <th>接害因素</th>
                            <th>主检结论</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr ng-show="CheckRecordList.length==0 && !PageLoading">
                            <td colspan="12" style="text-align:center;vertical-align:middle;line-height:30px;">没有数据</td>
                        </tr>
                        <tr ng-repeat="x in CheckRecordList">
                            <td style="text-align:center;">
                                <span>{{((result.currentPage-1)*20)+($index+1)}}</span>
                            </td>
                            <td ng-bind="x.CheckYear"></td>
                            <td style="text-align:center;" ng-bind="x.EmployeeInfo.EmployeeNo"></td>
                            <td style="text-align:center;" ng-bind="x.EmployeeInfo.EmployeeName"></td>
                            <td style="text-align:center;" ng-bind="x.EmployeeInfo.Gender"></td>
                            <td style="text-align:center;" ng-bind="x.EmployeeInfo.IdCardNo"></td>
                            <td style="text-align:center;" ng-bind="x.EmployeeInfo.DepartmentName"></td>
                            <td style="text-align:center;">{{x.CheckDate|JSONDate:'yyyy-MM-dd'}}</td>

                            <td style="text-align:center;" ng-bind="x.CheckType"></td>
                            <td ng-bind="x.WorkType"></td>
                            <td ng-bind="x.HarmFactor"></td>
                            <td ng-bind="x.ResultType"></td>
                            <td>
                                <a data-toggle="modal" href="#InfoModal" ng-click="ShowCheckRecordDetail(x);" class="btn btn-default btn-xs btn-label"><i class="fa fa-info-circle"></i>详细</a>
                                <a ng-if="@ViewBag.IsEdit==1" data-toggle="modal" href="#EditModal" ng-click="ShowCheckRecordDetail(x);" class="btn btn-primary btn-xs btn-label"><i class="fa fa-pencil-square-o"></i>编辑</a>
                                <button ng-if="@ViewBag.IsDelete==1" ng-click="DeleteCheckRecord(x,result.currentPage,SearchModel);" class="btn btn-danger btn-xs btn-label"><i class="fa fa-trash"></i>删除</button>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>

        </div>
        <div class="text-center" ng-show="CheckRecordList!=null && CheckRecordList.length>0">
            <ul class="pagination  justify-content-center">
                <li class="page-item"><a class="page-link" style="cursor:pointer;" ng-click="GetCheckRecordPageList(SearchModel,1);">首页</a></li>
                <li class="page-item" ng-class="{'active':result.currentPage==page}" ng-repeat="page in result.pages"><a style="cursor:pointer;" ng-click="GetCheckRecordPageList(SearchModel,page)" class="page-link" ng-bind="page"></a></li>
                <li class="page-item"><a class="page-link" style="cursor:pointer;" ng-click="GetCheckRecordPageList(SearchModel,(result.currentPage + 1 > result.totalPage ? result.totalPage : result.currentPage + 1))">下一页</a></li>
                <li class="page-item"><a class="page-link" style="cursor:pointer;" ng-click="GetCheckRecordPageList(SearchModel,result.totalPage);">尾页</a></li>
            </ul>
        </div>


    </form>
    <div class="modal fade" id="InfoModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog" style="min-width:985px;">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h2 class="modal-title">{{RecordDetail.EmployeeInfo.EmployeeName}}{{RecordDetail.CheckYear}}年体检记录</h2>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal" role="form">
                        <div class="form-group">
                            <label class="col-lg-2 control-label">工号：</label>
                            <div class="col-lg-3">
                                <input type="text" class="form-control" ng-model="RecordDetail.EmployeeInfo.EmployeeNo" readonly>
                            </div>
                            <label class="col-lg-2 control-label">姓名：</label>
                            <div class="col-lg-3">
                                <input type="text" class="form-control" ng-model="RecordDetail.EmployeeInfo.EmployeeName" readonly>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">性别：</label>
                            <div class="col-lg-3">
                                <input type="text" class="form-control" ng-model="RecordDetail.EmployeeInfo.Gender" readonly>
                            </div>
                            <label class="col-lg-2 control-label">证件号：</label>
                            <div class="col-lg-3">
                                <input type="text" class="form-control" ng-model="RecordDetail.EmployeeInfo.IdCardNo" readonly>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">体检日期：</label>
                            <div class="col-lg-3">
                                <input type="text" class="form-control" ng-model="RecordDetail.CheckDate" readonly>
                            </div>
                            <label class="col-lg-2 control-label">类型：</label>
                            <div class="col-lg-3">
                                <input type="text" class="form-control" ng-model="RecordDetail.CheckType" readonly>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">工种：</label>
                            <div class="col-lg-3">
                                <input type="text" class="form-control" ng-model="RecordDetail.WorkType" readonly>
                            </div>
                            <label class="col-lg-2 control-label">接害因素：</label>
                            <div class="col-lg-3">
                                <input type="text" class="form-control" ng-model="RecordDetail.HarmFactor" readonly>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">主检结果：</label>
                            <div class="col-lg-8">
                                <textarea rows="3" class="form-control" ng-model="RecordDetail.CheckResult" readonly>
                                </textarea>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">主检结论：</label>
                            <div class="col-lg-8">
                                <input type="text" class="form-control" ng-model="RecordDetail.Conclusion" readonly>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">医生建议：</label>
                            <div class="col-lg-8">
                                <input type="text" class="form-control" ng-model="RecordDetail.Advice" readonly>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">检查医院：</label>
                            <div class="col-lg-8">
                                <input type="text" class="form-control" ng-model="RecordDetail.Hospital" readonly>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal" id="btn_close2">关闭</button>
                </div>
            </div>
        </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->

    <div class="modal fade" id="EditModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog" style="min-width:985px;">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h2 class="modal-title">{{RecordDetail.EmployeeInfo.EmployeeName}}{{RecordDetail.CheckYear}}年体检记录</h2>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal" role="form">
                        <div class="form-group">
                            <label class="col-lg-2 control-label">工号：</label>
                            <div class="col-lg-3">
                                <input type="text" class="form-control" ng-model="RecordDetail.EmployeeInfo.EmployeeNo" readonly>
                            </div>
                            <label class="col-lg-2 control-label">姓名：</label>
                            <div class="col-lg-3">
                                <input type="text" class="form-control" ng-model="RecordDetail.EmployeeInfo.EmployeeName" readonly>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">性别：</label>
                            <div class="col-lg-3">
                                <input type="text" class="form-control" ng-model="RecordDetail.EmployeeInfo.Gender" readonly>
                            </div>
                            <label class="col-lg-2 control-label">证件号：</label>
                            <div class="col-lg-3">
                                <input type="text" class="form-control" ng-model="RecordDetail.EmployeeInfo.IdCardNo" readonly>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">体检日期：</label>
                            <div class="col-lg-3">
                                <datepicker id="startTime" option="datetimeOption" format="L" ng-model="RecordDetail.CheckDate"></datepicker>
                            </div>
                            <label class="col-lg-2 control-label">类型：</label>
                            <div class="col-lg-3">
                                <select class="form-control" ng-model="RecordDetail.CheckTypeId">
                                    <option value="">全部类型</option>
                                    <option value="{{x.Id}}" ng-repeat="x in CheckTypeList">{{x.CheckType}}</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">工种：</label>
                            <div class="col-lg-3">
                                <input type="text" class="form-control" ng-model="RecordDetail.WorkType">
                            </div>
                            <label class="col-lg-2 control-label">接害因素：</label>
                            <div class="col-lg-3">
                                <select id="select_Harm" class="selectpicker show-tick form-control" multiple data-live-search="true">
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">主检结果：</label>
                            <div class="col-lg-8">
                                <textarea rows="3" class="form-control" ng-model="RecordDetail.CheckResult">
                                </textarea>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">主检结论：</label>
                            <div class="col-lg-8">
                                <input type="text" class="form-control" ng-model="RecordDetail.Conclusion">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">医生建议：</label>
                            <div class="col-lg-8">
                                <input type="text" class="form-control" ng-model="RecordDetail.Advice">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">检查医院：</label>
                            <div class="col-lg-8">
                                <input type="text" class="form-control" ng-model="RecordDetail.Hospital">
                            </div>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal" id="btn_close">关闭</button>
                    <button type="button" class="btn btn-primary" ng-click="EditCheckRecord(RecordDetail,result.currentPage,SearchModel);">修改</button>
                </div>
            </div>
        </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->

</section>

@section Js{
    <script src="~/bussiness/js/pg/OHS.js?v=@DateTime.Now.ToString("yyMMddHHmm")"></script>
    <script src="~/bussiness/js/libs/moment.min.js"></script>
    <script src="~/bussiness/js/libs/locales/date/zh-cn.js"></script>
    <script src="~/bussiness/js/libs/bootstrap-datetimepicker.min.js"></script>
    <script src="~/bussiness/js/libs/angularjs-datepicker.js"></script>
    <script src="~/bussiness/js/libs/fileinput.js"></script>
    <script src="~/bussiness/js/libs/zh.js"></script>
    <script>
        $(".selectpicker").selectpicker({
            noneSelectedText: "所有接害因素"
        });
    </script>
}
